﻿module CodeCamp02_Attendees
{
  import CodeCamp01.BasicTypes;
  import CodeCamp01.Events;
  import CodeCamp01.Contents;
  import CodeCamp02_Schedule;

  // types
  
  type Attendee
  {
    Id : Integer32 => AutoNumber();
    EventId : Event where value in Events;
    Name : Text128;
    IsAnonymous : Logical;
  }

  type AttendeeSessionPick
  {
    Id : Integer32 => AutoNumber();
    AttendeeId : Attendee where value in Attendees;
    SessionId : Session where value in Sessions;
  }
    
  type AttendeeScheduledSession
  {
    Id : Integer32 => AutoNumber();
    AttendeeId : Attendee where value in Attendees;
    ScheduledSessionId : ScheduledSession where value in ScheduledSessions;
  }
  
  // extents
  
  Attendees : { Attendee* } where 
    identity Id;
  
  AttendeeSessionPicks : { AttendeeSessionPick* } where
    identity Id,
    unique( AttendeeId, SessionId );
    
  AttendeeScheduledSessions : { AttendeeScheduledSession* } where
    identity Id,
    unique( AttendeeId, ScheduledSessionId );
}